SRC=c/wav_to_bin.c c/text_to_wav.c ocaml/rabin.ml ocaml/call.ml interface/interface.c interface/event.c interface/interface_write.c c/stegano.c c/wav_to_text.c
TEMP=$(SRC:.c=.o)
OBJS=$(TEMP:.ml=.cmx)
LIBS=nums.cma
CFLAGS= -W -Werror -Wall -ansi -pedantic -ggdb
LDFLAGS= \
	-L/usr/local/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib/ocaml \
	-I /usr/local/lib/ocaml \
	$(shell sdl-config --libs) -lSDL_image -lSDL_ttf -lpthread -ggdb
PROG=steganodio


all:$(PROG)

.PHONY: $(PROG)

$(PROG):
	$(MAKE) -C c
	$(MAKE) -C ocaml
	$(MAKE) -C interface
	ocamlc -c $(LIBS) -cclib -lnums
	ocamlopt -cc $(CC) -o $(PROG) $(LIBS:.cma=.cmxa) $(OBJS) -cclib "$(LDFLAGS)"

install:
	mkdir /tmp/steganodiod
	cp -R * /tmp/steganodiod
	$(MAKE) -C /tmp/steganodiod

uninstall:distclean
	rm -f *
	$(MAKE) -C c clean
	$(MAKE) -C ocaml clean
	$(MAKE) -C interface clean

clean:distclean
	rm -f *~
	rm -f $(OBJS)
	rm -f cle_*
	rm -f \#*
	rm -f *.txt
	rm -f text
	rm -f res.wav
	rm -f temp.wav
	$(MAKE) -C c clean
	$(MAKE) -C ocaml clean
	$(MAKE) -C interface clean

distclean:
	rm -f $(PROG)